﻿<pfui:DialogWindow 
    x:Class="VsxFactory.Modeling.StrategyManager.Dialog.LicenseAcceptanceWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
    xmlns:self="clr-namespace:VsxFactory.Modeling.StrategyManager.Dialog"
    xmlns:pfui="clr-namespace:Microsoft.VisualStudio.PlatformUI;assembly=Microsoft.VisualStudio.Shell.10.0"
    ResizeMode="NoResize"
    Width="400"
    SizeToContent="Height"
    ShowInTaskbar="False"
    WindowStartupLocation="CenterOwner"
    Title="License Acceptance">
    
    <Window.Resources>
        <Style TargetType="{x:Type Button}">
            <Setter Property="Margin" Value="6,6,6,2" />
            <Setter Property="Padding" Value="10,3,10,3" />
        </Style>
        <self:StringCollectionsToStringConverter x:Key="authorNamesConverter" />
        <DataTemplate x:Key="LicenseItemTemplate">
            <StackPanel Margin="2,0,2,5">
                <TextBlock TextWrapping="Wrap">
                    <Run Text="{Binding Id, Mode=OneTime}" FontWeight="Bold" />
                    <Run Text=" " />
                    <Run Text="{Binding Authors, Mode=OneTime, StringFormat=(Author: {0}), Converter={StaticResource authorNamesConverter}}" />
                </TextBlock>
                <TextBlock>
                    <Hyperlink NavigateUri="{Binding LicenseUrl, Mode=OneTime}" RequestNavigate="OnViewLicenseTermsRequestNavigate">View License Terms</Hyperlink>
                </TextBlock>
            </StackPanel>
        </DataTemplate>
    </Window.Resources>
    
    <Grid Margin="10">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="*" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>
        
        <TextBlock Grid.Row="0" Margin="0,3,0,3" Text="The following package(s) will be installed:" />
        <ItemsControl
            ScrollViewer.VerticalScrollBarVisibility="Auto"
            Grid.Row="1" 
            Margin="0,0,0,3" 
            MinHeight="130" 
            Padding="3" 
            BorderThickness="1" 
            BorderBrush="{DynamicResource {x:Static SystemColors.ActiveBorderBrushKey}}" 
            Background="{DynamicResource {x:Static SystemColors.WindowBrushKey}}"
            ItemsSource="{Binding}"
            ItemTemplate="{StaticResource LicenseItemTemplate}">
        </ItemsControl>
        <TextBlock Grid.Row="2" Margin="0,0,0,3" TextWrapping="Wrap" Text="By clicking &quot;I Accept,&quot; you agree to the license terms for the product or component listed above. If you do not agree to the license terms, click &quot;I Decline&quot;." />
        <StackPanel Grid.Row="3" Margin="0,0,0,3" Orientation="Horizontal"  HorizontalAlignment="Right">
            <Button Content="I _Decline" Click="OnDeclineButtonClick" IsCancel="True" />
            <Button Content="I _Accept" Click="OnAcceptButtonClick" />
        </StackPanel>
    </Grid>
</pfui:DialogWindow>